import React, { useEffect, useState } from 'react';
import { Table, Button } from 'antd'

// import { getData } from '../../service/test'

import './index.scss'

function Test(){
  const [data, setData] = useState([]);// 定义

  const dataSource = [
    {
      key: '1',
      name: '胡彦斌',
      age: 32,
      address: '西湖区湖底公园1号',
    },
    {
      key: '2',
      name: '胡彦祖',
      age: 42,
      address: '西湖区湖底公园1号',
    },
  ];
  
  const columns = [
    {
      title: '姓名',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '年龄',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: '住址',
      dataIndex: 'address',
      key: 'address',
    },
  ];

  // 请求数据
  useEffect(()=>{
    setData("测试页面")

    // getAllData()
  },[])

  // 请求数据案例
  // function getAllData(){
  //   getData({page:1 ,limit:20 ,tab:''}).then(res=>{
  //     console.log(45, res)
  //   })
  // }
  
  
  return <div className='test-container'>
    <p className='title'>{data}</p>
    <Button type="primary" className='btn'>按钮</Button>
    <Table dataSource={dataSource} columns={columns} />
  </div>;
}

export default Test;



